diff options
| author | Adam Soltys <[email protected]> | 2023-11-10 21:33:49 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-11-11 00:04:22 -0800 |
| commit | ae87f1d43c6d2cf34bd2ea6fd7b4d28af6d2aa91 (patch) | |
| tree | 694efda287338a3b81c5d7d41328c9f2e30e5218 /src/routes/(app)/fund/[id]/sweep | |
| parent | efdbc67c17fab67bf3cdce448a30aa82f62c5212 (diff) | |
| download | coinos-ui-ae87f1d43c6d2cf34bd2ea6fd7b4d28af6d2aa91.tar.gz coinos-ui-ae87f1d43c6d2cf34bd2ea6fd7b4d28af6d2aa91.zip | |
nav update
Diffstat (limited to 'src/routes/(app)/fund/[id]/sweep')
| -rw-r--r-- | src/routes/(app)/fund/[id]/sweep/+page.server.js | 14 | ||||
| -rw-r--r-- | src/routes/(app)/fund/[id]/sweep/+page.svelte | 37 |
2 files changed, 51 insertions, 0 deletions
diff --git a/src/routes/(app)/fund/[id]/sweep/+page.server.js b/src/routes/(app)/fund/[id]/sweep/+page.server.js new file mode 100644 index 00000000..9fd244a3 --- /dev/null +++ b/src/routes/(app)/fund/[id]/sweep/+page.server.js @@ -0,0 +1,14 @@ +import { get, auth, post } from '$lib/utils'; +import { redirect } from '@sveltejs/kit'; + +export async function load({ cookies, params, parent }) { + let { user } = await parent(); + let { id } = params; + let { amount } = await get(`/fund/${id}`); + + + if (!amount) throw redirect(307, `/fund/${id}`); + if (!user) throw redirect(307, `/register?redirect=/fund/${id}/sweep`); + await post('/take', { amount, id }, auth(cookies)); + return { amount, id }; +} diff --git a/src/routes/(app)/fund/[id]/sweep/+page.svelte b/src/routes/(app)/fund/[id]/sweep/+page.svelte new file mode 100644 index 00000000..64bed4dd --- /dev/null +++ b/src/routes/(app)/fund/[id]/sweep/+page.svelte @@ -0,0 +1,37 @@ +<script> + import { scale } from 'svelte/transition'; + import { fiat, f, s } from '$lib/utils'; + import { Icon } from '$comp'; + import { t } from '$lib/translations'; + + export let data; + + let { amount, id, user, rates } = data; + let { currency } = user; + $: rate = rates[currency]; +</script> + +<div class="container px-4 max-w-xl mx-auto mt-10 space-y-5 text-center"> + <div class="w-full flex"> + <a href="/" class="mx-auto"> + <Icon icon="logo" /> + </a> + </div> + + <div class="flex w-full py-5 max-w-[200px] mx-auto" in:scale={{ start: 0.5 }}> + <Icon icon="check" style="mx-auto" /> + </div> + <h1 class="text-3xl md:text-4xl font-bold mb-6">{$t('payments.fundsClaimed')}</h1> + <h2 class="text-2xl md:text-3xl font-semibold"> + {f(fiat(amount, rate), currency)} + </h2> + <h3 class="text-secondary md:text-lg mb-6 mt-1"> + ⚡️{s(amount)} + </h3> +</div> + +<a href={`/${user.username}/payments`}> + <div class="opacity-0 w-screen h-screen fixed top-0 left-0 z-50" /> +</a> + +<div class="fixed bottom-10 w-full text-center">{$t('payments.tapAnywhere')}</div> |
